package com.by.basicweb.utils;


import com.by.toolkit.consts.WebGlobalConst;
import com.by.toolkit.enums.FlagEnum;
import com.by.toolkit.utils.ThreadLocalUtil;

public class FromGatewayUtil {

    private FromGatewayUtil() {
    }

    private static class FromGatewayUtilHolder {
        public static final FromGatewayUtil INSTANCE = new FromGatewayUtil();
    }

    public static FromGatewayUtil getInstance() {
        return FromGatewayUtilHolder.INSTANCE;
    }

    public void put(Integer flag) {
        ThreadLocalUtil.put(WebGlobalConst.FROM_GATEWAY, flag, false);
    }

    public boolean get() {
        return FlagEnum.resolve(ThreadLocalUtil.getInt(WebGlobalConst.FROM_GATEWAY));
    }

    public void remove() {
        ThreadLocalUtil.removeKey(WebGlobalConst.FROM_GATEWAY, true);
    }

}
